]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Separate out spacing/padding code
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 26 Feb 2013 03:38:30 +0000 (22:38 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 22 Apr 2013 18:01:00 +0000 (14:01 -0400)
This will be used when we introduce the second geometry.

https://bugzilla.gnome.org/show_bug.cgi?id=694469

js/ui/workspace.js

index 30c09fac509cf58f242d975a3b184714f5a92502..d0d989ee81deef872bf4da0a30f55f7806c36124 100644 (file)
@@ -890,6 +890,14 @@ const UnalignedLayoutStrategy = new Lang.Class({
     }
 });
 
+function padArea(area, padding) {
+    return {
+        x: area.x + padding.left,
+        y: area.y + padding.top,
+        width: area.width - padding.left - padding.right,
+        height: area.height - padding.top - padding.bottom,
+    };
+}
 
 /**
  * @metaWorkspace: a #Meta.Workspace, or null
@@ -1506,7 +1514,7 @@ const Workspace = new Lang.Class({
         return lastLayout;
     },
 
-    _computeAllWindowSlots: function(windows) {
+    _getSpacingAndPadding: function() {
         let node = this.actor.get_theme_node();
 
         // Window grid spacing
@@ -1535,13 +1543,12 @@ const Workspace = new Lang.Class({
         padding.left += leftBorder;
         padding.right += rightBorder;
 
-        let area = {
-            x: this._fullGeometry.x + padding.left,
-            y: this._fullGeometry.y + padding.top,
-            width: this._fullGeometry.width - padding.left - padding.right,
-            height: this._fullGeometry.height - padding.top - padding.bottom,
-        };
+        return [rowSpacing, columnSpacing, padding];
+    },
 
+    _computeAllWindowSlots: function(windows) {
+        let [rowSpacing, columnSpacing, padding] = this._getSpacingAndPadding();
+        let area = padArea(this._fullGeometry, padding);
         let layout = this._computeLayout(windows, area, rowSpacing, columnSpacing);
         return layout.strategy.computeWindowSlots(layout, area);
     },